#!/usr/bin/env ruby

case ARGV[0]
when "version"
  require "rexml/document"
  require "rexml/xpath"
  doc = REXML::Document.new(File.open("Info.plist"))
  puts REXML::XPath.first(doc, "//dict/key[text()='CFBundleVersion']").next_element.text
when NilClass
  puts "Usage: #{$1} <command>"
  puts "Possible commands: version"
  exit 1
else
  puts "Unknown command: #{ARG[1]}"
  exit 1
end
